import React from 'react';
import { Icon } from 'antd';
import { WeaLocaleProvider } from 'ecCom';

const getLabel = WeaLocaleProvider.getLabel;

class Message extends React.Component {
  render() {
    const { message } = this.props;

    let Content = <div />;
    if (message == '1') {
      Content = (
        <div style={{ position: 'relative', height: '100px' }}>
          <div
            style={{
              position: 'absolute',
              top: '50%',
              left: '50%',
              width: '110px',
              height: '25px',
              lineHeight: '25px',
              marginTop: '-13px',
              marginLeft: '-55px',
              color: '#209e29',
              fontSize: '18px',
              textAlign: 'center',
            }}
          >
            <Icon ecId={`${this && this.props && this.props.ecId || ''}_Icon@pk5fxg`} type="check-circle" />
            <span style={{ marginLeft: '10px' }}>Success !</span>
          </div>
        </div>
      );
    } else if (message == '0') {
      Content = (
        <div>
          <p>
            {getLabel(517212, 'License信息错误，请检查启动脚本是否包含GBK字符集并重新启动Resin尝试，并且检查License是否正确(E8要求更换公司名称的授权必须清空ecology/license目录再重启Resin提交)！')}
          </p>
          <p style={{ marginTop: '10px' }}>
            License message error, please check the start script contain GBK and try to restart Resin and check if the License is correct(you must clear ecology/license and restart resin before you
            upload the difference conpanyname License in E8)!
          </p>
        </div>
      );
    } else if (message == '2') {
      Content = (
        <div>
          <p>
            {getLabel(517213, '数据库连接或者执行失败，请按下列步骤检查：')}
            <br />
            {getLabel(517214, '1.检查数据库服务器是否正常；')}
            <br />
            {getLabel(517215, '2.检查数据库驱动包是否存在；')}
            <br />
            {getLabel(517216, '3.检查weaver.properies配置信息是否正确；')}
            <br />
            {getLabel(517217, '4.检查ecology日志是否有异常！')}
          </p>
          <p style={{ marginTop: '10px' }}>
            Failed to Connect Data Server, please check by step as below: <br />
            1.checking the Data Server is OK; <br />
            2.checking the SQL driver is exist; <br />
            3.checking the message of the file weaver.properies is right; <br />
            4.Check ecology log exception!
          </p>
        </div>
      );
    } else if (message == '3') {
      Content = (
        <div>
          <p>{getLabel(517218, 'License文件上传出错！')}</p>
          <p style={{ marginTop: '10px' }}>License file uploading error!</p>
        </div>
      );
    } else if (message == '4') {
      Content = (
        <div>
          <p>{getLabel(517219, 'License信息错误，License已过期！')}</p>
          <p style={{ marginTop: '10px' }}>License message error, license is overdue!</p>
        </div>
      );
    } else if (message == '5') {
      Content = (
        <div>
          <p>{getLabel(517220, 'License信息错误，已分配用户数大于License申请人数！')}</p>
          <p style={{ marginTop: '10px' }}>License message error, the HRMs is larger than the apllied in the license!</p>
        </div>
      );
    } else if (message == '6') {
      Content = (
        <div>
          <p>{getLabel(517221, '没有选择正确的License文件或者License文件不存在！')}</p>
          <p style={{ marginTop: '10px' }}>Wrong choosing License file or License file is not exist!</p>
        </div>
      );
    } else if (message == '7') {
      Content = (
        <div>
          <p>
            {getLabel(517222, '1.验证码不得为空！')}
            <br />
            {getLabel(517223, '2.系统设置表SystemSet字段filesystem值对应路径(默认为空)不存在或者没有写权限，详细见ecology/log/ecology日志！')}
          </p>
          <p style={{ marginTop: '10px' }}>
            1.Verification code must not be empty! <br />
            2.System error, detail to see the ecology log!
          </p>
        </div>
      );
    } else if (message == '-99') {
      Content = (
        <div>
          <p>{getLabel(520319, '授权客户ID不一致！请申请正确的授权文件或者联系泛微申请license初始化包进行初始化后再重新提交！')}</p>
          <p style={{ marginTop: '10px' }}>Authorized customer ID is inconsistent! Please apply for the correct authorization file
           or contact weaver get License initialization package for initialization before resubmitting!</p>
        </div>
      );
    } else if (message == '512664' || message == '512663') {
      Content = (
        <div>
          <p>{getLabel(520320, '用户取消提交不同类型的授权文件！')}</p>
          <p style={{ marginTop: '10px' }}>Users cancel submitting different types of authorization files!</p>
        </div>
      );
    } else {
      Content = <div>{message}</div>;
    }

    return <div style={{ position: 'relative', margin: '50px', lineHeight: '20px', color: '#d62c2c', fontSize: '14px' }}>{Content}</div>;
  }
}

export default Message;
